﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pay.Core;

namespace Pay.DTO {
    /// <summary>
    /// 产品分类：Category
    /// </summary>
    [Serializable]
    public class category_dto {
        public category_dto() {
            image_urls = new List<string>();
        }

        /// <summary>
        /// 分类id
        /// </summary>
        public long id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 图片URL集合
        /// </summary>
        public List<string> image_urls { get; set; }
        /// <summary>
        /// 第一张图片URL
        /// </summary>
        public string first_url {
            get
            {
                if (image_urls.Count > 0) return image_urls.First();
                return string.Empty;
            }
        }
        /// <summary>
        /// 上级分类
        /// </summary>
        public long parent_id { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; set; }
        /// <summary>
        /// 获取积分的比例，如10，就是1元
        /// </summary>
        public decimal in_rate { get; set; }
        /// <summary>
        /// 消费积分比例，如100积分
        /// </summary>
        public decimal out_rate { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public string remark { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? update_time { get; set; }
        /// <summary>
        /// 是否禁用
        /// </summary>
        public bool is_disabled { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool is_deleted { get; set; }
    }

    /// <summary>
    /// 分类
    /// </summary>
    [Serializable]
    public class category_ex {
        public category_ex() {
            image_urls = new List<string>();
            children = new List<category_ex>();
        }
        /// <summary>
        /// 分类id
        /// </summary>
        public long id { get; set; }
        /// <summary>
        /// 深度
        /// </summary>
        public int depth { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public string remark { get; set; }
        /// <summary>
        /// 图片URL集合
        /// </summary>
        public List<string> image_urls { get; set; }
        /// <summary>
        /// 商户id
        /// </summary>
        public long merchant_id { get; set; }
        /// <summary>
        /// 获取积分的比例，如10，就是1元
        /// </summary>
        public decimal in_rate { get; set; }
        /// <summary>
        /// 消费积分比例，如10，就是10积分
        /// </summary>
        public decimal out_rate { get; set; }
        /// <summary>
        /// 第一张图片URL
        /// </summary>
        public string first_url {
            get
            {
                if (image_urls.Count > 0) return image_urls.First();
                return string.Empty;
            }
        }
        /// <summary>
        /// 上级分类
        /// </summary>
        public long parent_id { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; set; }
        /// <summary>
        /// 子分类
        /// </summary>
        public List<category_ex> children { get; set; }
    }

    /// <summary>
    /// 分类请求信息
    /// </summary>
    [Serializable]
    public class category_model : head_req {
        public category_model() {
            image_urls = new List<string>();
        }

        /// <summary>
        /// 分类id
        /// </summary>
        public long id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 说明
        /// </summary>
        public string remark { get; set; }
        /// <summary>
        /// 图片URL集合
        /// </summary>
        public List<string> image_urls { get; set; }
        /// <summary>
        /// 上级分类
        /// </summary>
        public long parent_id { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int sort { get; set; }
    }

    /// <summary>
    /// 产品分类：Category
    /// </summary>
    [Serializable]
    public class token_category_dto {
        /// <summary>
        /// 分类id
        /// </summary>
        public long id { get; set; }
        /// <summary>
        /// 名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 上级分类Id
        /// </summary>
        public long parent_id { get; set; }
        /// <summary>
        /// 深度
        /// </summary>
        public int depth { get; set; }
        /// <summary>
        /// 路径
        /// </summary>
        public string path { get; set; }
        /// <summary>
        /// 商户Id
        /// </summary>
        public long merchant_id { get; set; }
        /// <summary>
        /// 上级名称
        /// </summary>
        public string parent_name { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public long sort { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? update_time { get; set; }
        /// <summary>
        /// 是否禁用
        /// </summary>
        public bool is_disabled { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool is_deleted { get; set; }
        /// <summary>
        /// 0 默认分类 1 集市分类
        /// </summary>
        public int type { get; set; }
        /// <summary>
        /// 图片URL集合
        /// </summary>
        public List<string> image_urls { get; set; }
        /// <summary>
        /// 第一张图片URL
        /// </summary>
        public string first_url {
            get
            {
                if (image_urls != null && image_urls.Count > 0) return image_urls.First();
                return string.Empty;
            }
        }
    }

    [Serializable]
    public class token_category_dto_ex : token_category_dto {

        public token_category_dto_ex() {
            first_category_list = new List<DropdownItem>();
        }

        /// <summary>
        /// 一级品类下拉列表
        /// </summary>
        public List<DropdownItem> first_category_list { get; set; }
        /// <summary>
        /// 上级分类Id
        /// </summary>
        public string parent_id_value { get; set; }
    }
}